    var http = require('http');
    var fs = require('fs');

    var server = http.createServer(function (req, res) {
        var stream = fs.createReadStream(__dirname + '/data.txt');

        // 调用.pipe()方法,连接流对象
        stream.pipe(res);
    });
    server.listen(8000);